<template>
    <div>Home....</div>
    <div>store：{{ $store.state.count }}</div>
    <div>num：{{ num }}</div>
    <br />
    <button @click="mutationsAdd">mutations-加加</button>
    <button @click="actionsAdd">actions-加加</button>
</template>

<script>
import { ref, reactive } from 'vue'
import { useStore } from "vuex";
export default {
    setup() {
        let num = reactive({
            num: 0
        })
        const store = useStore(); // 使用useStore方法
        function mutationsAdd() {
            store.commit('getIncrement', 1000)
            num.value = store.state.count;
            console.log(num.value);
        };
        function actionsAdd() {
            store.dispatch('actionsIncrement', '66')
            num.value = store.state.count;
        }
        return { mutationsAdd, actionsAdd, num };
    }
}
</script>

